package com.Smart.smartscals.Fragment;

import javax.crypto.Mac;

import com.Smart.smartscals.Activity.ActivityGuide;
import com.Smart.smartscals.Activity.R;
import com.Smart.smartscals.CustomView.CustomSexchoiceView;
import com.Smart.smartscals.Utils.Tools;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

public class FragmentGudeSex extends BaseFragment {

	private Button btnNext, btnBack;
	private EditText editTextName;
	private CustomSexchoiceView mCustomSexchoiceView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		initView();
		initParam();
		setListener();
	}

	private void initParam() {
		mActivityGuide = (ActivityGuide) this.getActivity();
	}

	private void setListener() {
		initNextLastBtnListener();
		layBack.setOnClickListener(this);
	}

	private void initView() {
		initTopImgBtn();
		initButton();
		initToastTvBigSmall();
		mCustomSexchoiceView = (CustomSexchoiceView) mView
				.findViewById(R.id.frgment_guide_choicesex);
		setTextSmallBig(R.string.guide_sexis, R.string.guide_sexisornot);

	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		mView = inflater.inflate(R.layout.fragment_guide_choicesex, null);
		return mView;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		super.onClick(v);

		switch (v.getId()) {
		case R.id.btn_guide_back:
			backDoJob(this);
			break;

		case R.id.btn_guide_next:
			nextDoJOb();
			break;

		case R.id.guide_linelayout_top_back:
			backDoJob(this);
			break;

		default:
			break;
		}
	}

	private void nextDoJOb() {
		// mActivityGuide.getmFragmentTransaction().

		if (mCustomSexchoiceView.getStatue() == 1) {

			Tools.startFragment(mActivityGuide,
					mActivityGuide.getmFragmentGudeHeight());
			mActivityGuide.getmEntityUserInfo().setmSex(this.getString(R.string.sex_meal));
		} else if (mCustomSexchoiceView.getStatue() == 2) {
			Tools.startFragment(mActivityGuide,
					mActivityGuide.getmFragmentGudeHeight());
			mActivityGuide.getmEntityUserInfo().setmSex(this.getString(R.string.sex_femal));

		}else{
			Tools.setToast(mActivityGuide, this.getString(R.string.guide_toast_edit_error));
		}
	
	}

}
